#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<errno.h>
#include<signal.h>
#include<sys/time.h>
#include<fcntl.h>
#include<unistd.h> 
#include<pthread.h>


void* myfunc(void* p){
	int *i = (int*) malloc(sizeof(int));
	*i = (long long) p;
	return (void*) i;
}
int main(int argc, char* args[])
{
	pthread_t tid;
	for(int i = 0; i < 5; i ++){
		pthread_create(&tid, NULL, myfunc, (void*) i);
		int *retval;
		pthread_join(tid, (void**) &retval);
		printf("retval is %d\n", *retval);
		
		free(retval);
	}

}
